package com.bandapp.adapters;

import java.util.List;
import android.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class BandAdapter<Band> extends ArrayAdapter<Band> {

	private List<Band> bands;
	
	public BandAdapter(Context context, int textViewResourceId, List<Band> objects) {
		super(context, textViewResourceId, objects);
		// TODO Auto-generated constructor stub
		bands = objects;		
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View row;
 
		if (null == convertView) {
			LayoutInflater mInflater = (LayoutInflater)this.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			row = mInflater.inflate(R.layout.simple_list_item_1, null);
		} else {
			row = convertView;
		}
 
		TextView tv = (TextView) row.findViewById(android.R.id.text1);
		com.bandapp.bo.Band band = (com.bandapp.bo.Band) bands.get(position);
		tv.setText(band.getBandname());
 
		return row;
	}

	
	
}
